package com.sdy.healthcode.biz.mapper;

import com.sdy.healthcode.biz.model.UserAction;
import com.sdy.mvc.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zzq
 * @since 2020-02-18
 */
public interface UserActionMapper extends BaseMapper<UserAction> {

    /**
     * 扫码进入人数
     */
    @Select("select count(distinct(user_id)) from user_action " +
            "where type in (1, 2) " +
            "and action = ${action} " +
            "and strategy = 1 " +
            "and record_date = #{dateStr}")
    Integer countScanUserCount(@Param("dateStr") String dateStr,
                               @Param("action") Integer action);
}
